Returns an enumerator that iterates through the collection.
Syntax
Example
Library/Library.Test/TestBTreeDictionary.cs
C# | Copy Code |
---|
BTreeDictionary<int, string> data = new BTreeDictionary<int, string>(Comparer, GetSample());
BTreeDictionary<int, string> copy = (BTreeDictionary<int, string>) ((ICloneable) data).Clone();
using(IEnumerator<KeyValuePair<int, string>> e1 = data.GetEnumerator())
using(IEnumerator<KeyValuePair<int, string>> e2 = copy.GetEnumerator())
{
while(e1.MoveNext() && e2.MoveNext())
{
Assert.AreEqual(e1.Current.Key, e2.Current.Key);
Assert.AreEqual(e1.Current.Value, e2.Current.Value);
}
Assert.IsFalse(e1.MoveNext() || e2.MoveNext());
} |
VB.NET | Copy Code |
---|
Dim data As New BTreeDictionary(Of Integer, String)(Comparer, GetSample())
Dim copy As BTreeDictionary(Of Integer, String) = DirectCast((DirectCast(data, ICloneable)).Clone(), BTreeDictionary(Of Integer, String))
Using e1 As IEnumerator(Of KeyValuePair(Of Integer, String)) = data.GetEnumerator()
Using e2 As IEnumerator(Of KeyValuePair(Of Integer, String)) = copy.GetEnumerator()
While e1.MoveNext() AndAlso e2.MoveNext()
Assert.AreEqual(e1.Current.Key, e2.Current.Key)
Assert.AreEqual(e1.Current.Value, e2.Current.Value)
End While
Assert.IsFalse(e1.MoveNext() OrElse e2.MoveNext())
End Using
End Using |
Requirements
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
See Also